package com.note7_11.question1;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

public class Question1 {

	/*
	 * 服务器上存有多个用户对象（包括用户和密码），客户端通过socket登录，如果成功，输出欢迎信息，失败给出提示。
	 */
	public static void main(String[] args) throws Exception {
		List<User> list = new ArrayList<User>();
		User user0 = new User("admin","admin");
		User user1 = new User("admin1","admin1");
		User user2 = new User("admin2","admin2");
		list.add(user0);
		list.add(user1);
		list.add(user2);
		Login l = new Login(list);
		ServerSocket ss = new ServerSocket(8090);
		while(true){
			System.out.println("服务启动成功！");
			Socket s = ss.accept();
			new Server(s,l).start();
		}
	}
	
}
